package org.xerial.silk.editor.plugin.preferences;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.dltk.ui.CodeFormatterConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.xerial.silk.editor.plugin.SilkPlugin;
import org.xerial.silk.editor.plugin.text.SilkColor;

/**
 * Class used to initialize default preference values.
 */
public class SilkPreferenceInitializer extends AbstractPreferenceInitializer
{

    /*
     * (non-Javadoc)
     * 
     * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
     */
    @Override
    public void initializeDefaultPreferences() {
        IPreferenceStore store = SilkPlugin.getDefault().getPreferenceStore();

        // 
        //preferenceStore.setValue("formatter.tabulation.size", 2);

        // Initialize DLTK default values
        org.eclipse.dltk.ui.PreferenceConstants.initializeDefaultValues(store);

        store.setDefault(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.TAB);
        store.setDefault(CodeFormatterConstants.FORMATTER_TAB_SIZE, 2);
        store.setDefault(CodeFormatterConstants.FORMATTER_INDENTATION_SIZE, 2);
        //store.setDefault(PreferenceConstants.EDITOR_TAB_WIDTH, 2);
        //store.setDefault(PreferenceConstants.EDITOR_TAB_ALWAYS_INDENT, true);
        //store.setValue("formatter.tabulation.size", 2);

        // set default color
        for (SilkColor each : SilkColor.values()) {
            PreferenceConverter.setDefault(store, each.key, each.defaultColor);
        }

    }

}
